﻿package  
{
	import com.danielsheldon.effects.particles.Emitter;
	import com.danielsheldon.effects.particles.ParticleEngine;
	import com.danielsheldon.effects.particles.Dot;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	/**
	 * ...
	 * @author Daniel Sheldon
	 */
	public class ParticleTest extends MovieClip
	{
		
		private var engine:ParticleEngine;
		
		public function ParticleTest() 
		{
			for (var i:int = 0; i < 20; i++)
			{
				var emitter:Emitter = ParticleEngine.newEmitter(this, Dot);
				emitter.x = Math.random() * stage.stageWidth;
				emitter.y = Math.random() * stage.stageHeight;
				
				emitter.density = 10;
				emitter.start();
			}
			
			button.addEventListener(MouseEvent.CLICK, pause)
		}
		
		private var paused:Boolean = false;
		private function pause(e:MouseEvent):void 
		{
			if (paused)
			{
				ParticleEngine.resumeAll();
			}else
			{
				ParticleEngine.pauseAll();
			}
			
			paused = !paused;
		}
		
	}
	
}